.TH "/Users/deepaksubramanian/Documents/Folder of Documents/XCode/ESAPI_COMPLETE/branches/ESAPI Branch Cuckoo/Pure C functions/ESAPIEncoder/ESAPICEncoder.c" 3 "Sat Jul 9 2011" "Version v0.0.1 (Alpha)" "ESAPI" \" -*- nroff -*-
.ad l
.nh
.SH NAME
/Users/deepaksubramanian/Documents/Folder of Documents/XCode/ESAPI_COMPLETE/branches/ESAPI Branch Cuckoo/Pure C functions/ESAPIEncoder/ESAPICEncoder.c \- 
.SH SYNOPSIS
.br
.PP
\fC#include 'ESAPICEncoder.h'\fP
.br
\fC#include 'ESAPICUrlEncoder.h'\fP
.br
\fC#include <stdio.h>\fP
.br
\fC#include 'ESAPICBase64Encoder.h'\fP
.br
\fC#include <string.h>\fP
.br

.SS "Functions"

.in +1c
.ti -1c
.RI "\fBESAPIStringOperation\fP * \fBESAPICEncode\fP (char *inputString, \fBESAPIEncodingType\fP typeOfEncoding)"
.br
.RI "\fIThis function is used to encode the given string and return the resultant encoded string. \fP"
.ti -1c
.RI "\fBESAPIStringOperation\fP * \fBESAPICDecode\fP (char *inputString, \fBESAPIEncodingType\fP typeOfEncoding)"
.br
.RI "\fIThis function is used to decode the given string and return the resultant decoded string. \fP"
.ti -1c
.RI "\fBESAPIStringOperation\fP * \fBESAPICCanonicalizationForSpecificEncodingType\fP (char *inputString, \fBESAPIEncodingType\fP typeOfEncoding, bool strict)"
.br
.RI "\fIThis function is used to decode the given string to canonical form and return the resultant decoded string. \fP"
.ti -1c
.RI "\fBESAPIStringOperation\fP * \fBESAPICCanonicalizationAllAvailableEncodings\fP (char *inputString, bool strict)"
.br
.RI "\fIThis function is used to decode the given string to canonical form and return the resultant decoded string. \fP"
.in -1c
.SS "Variables"

.in +1c
.ti -1c
.RI "const int \fBnumberOfAvailableCodecs\fP = 2"
.br
.ti -1c
.RI "\fBESAPIStringOperation\fP *(* \fBencodingFunctionsArray\fP [2])(char *) = { ESAPICUrlEncoderEncode , ESAPICBase64EncoderEncode }"
.br
.ti -1c
.RI "\fBESAPIStringOperation\fP *(* \fBdecodingFunctionsArray\fP [2])(char *) = { ESAPICUrlEncoderDecode , ESAPICBase64EncoderDecode }"
.br
.in -1c
.SH "Function Documentation"
.PP 
.SS "\fBESAPIStringOperation\fP* ESAPICCanonicalizationAllAvailableEncodings (char *inputString, boolstrict)"
.PP
This function is used to decode the given string to canonical form and return the resultant decoded string. NOTE: This function canonicalizes for all available encodings.
.PP
\fBParameters:\fP
.RS 4
\fIinputString\fP - The string to be encoded. 
.br
\fItypeOfEncoding\fP - The type of encoding required 
.br
\fIstrict\fP - If the strict flag is set, the decoding will fail in case of Multiple encoding/Mixed encoding etc.,
.RE
.PP
{ 
.PP
.nf
        char inputString[] = 'sometext';
        ESAPIStringOperation * decodedStringOperation = ESAPICCanonicalizationAllAvailableEncodings ( inputString, false );
        if ( decodedStringOperation->operationSuccessful )
        {
                char * decodedString = decodedStringOperation->returnString;
                //Use the decodedString for operations.
                free ( decodedString );
        }
        else
        {
                char * errorDescription = encodedStringOperation->errorDescription;
                //The decoding has failed. Manage accordingly.
                free ( errorDescription );
        }
        free ( decodedStringOperation );

.fi
.PP
 } 
.PP
Definition at line 121 of file ESAPICEncoder.c.
.PP
References ESAPIStringOperation::errorDescription, ESAPICCanonicalizationForSpecificEncodingType(), numberOfAvailableCodecs, ESAPIStringOperation::operationSuccessful, and ESAPIStringOperation::returnString.
.SS "\fBESAPIStringOperation\fP* ESAPICCanonicalizationForSpecificEncodingType (char *inputString, \fBESAPIEncodingType\fPtypeOfEncoding, boolstrict)"
.PP
This function is used to decode the given string to canonical form and return the resultant decoded string. NOTE: This function canonicalizes for only one given encoding type.
.PP
\fBParameters:\fP
.RS 4
\fIinputString\fP - The string to be encoded. 
.br
\fItypeOfEncoding\fP - The type of encoding required 
.br
\fIstrict\fP - If the strict flag is set, the decoding will fail in case of Multiple encoding/Mixed encoding etc.,
.RE
.PP
{ 
.PP
.nf
 char inputString[] = 'sometext';
 ESAPIStringOperation * decodedStringOperation = ESAPICanonicalizationForSpecificEncodingType ( inputString, ESAPIEncodingTypePercentEncoding, false );
 if ( decodedStringOperation->operationSuccessful )
 {
        char * decodedString = decodedStringOperation->returnString;
        //Use the decodedString for operations.
        free ( decodedString );
 }
 else
 {
        char * errorDescription = encodedStringOperation->errorDescription;
        //The decoding has failed. Manage accordingly.
        free ( errorDescription );
 }
 free ( decodedStringOperation );

.fi
.PP
 } 
.PP
Definition at line 59 of file ESAPICEncoder.c.
.PP
References ESAPIStringOperation::errorDescription, ESAPICDecode(), ESAPIStringOperation::operationSuccessful, and ESAPIStringOperation::returnString.
.PP
Referenced by ESAPICCanonicalizationAllAvailableEncodings(), and main().
.SS "\fBESAPIStringOperation\fP* ESAPICDecode (char *inputString, \fBESAPIEncodingType\fPtypeOfEncoding)"
.PP
This function is used to decode the given string and return the resultant decoded string. \fBParameters:\fP
.RS 4
\fIinputString\fP - The string to be encoded. 
.br
\fItypeOfEncoding\fP - The type of encoding required
.RE
.PP
{ 
.PP
.nf
  char inputString[] = 'sometext';
        ESAPIStringOperation * decodedStringOperation = ESAPIDecode ( inputString, ESAPIEncodingTypePercentEncoding );
        if ( decodedStringOperation->operationSuccessful )
        {
                char * decodedString = decodedStringOperation->returnString;
                //Use the decodedString for operations.
                free ( decodedString );
        }
        else
        {
                char * errorDescription = encodedStringOperation->errorDescription;
                //The decoding has failed. Manage accordingly.
                free ( errorDescription );
        }
        free ( decodedStringOperation );

.fi
.PP
 } 
.PP
Definition at line 40 of file ESAPICEncoder.c.
.PP
References decodingFunctionsArray, ESAPIStringOperation::errorDescription, numberOfAvailableCodecs, and ESAPIStringOperation::operationSuccessful.
.PP
Referenced by ESAPICCanonicalizationForSpecificEncodingType().
.SS "\fBESAPIStringOperation\fP* ESAPICEncode (char *inputString, \fBESAPIEncodingType\fPtypeOfEncoding)"
.PP
This function is used to encode the given string and return the resultant encoded string. \fBParameters:\fP
.RS 4
\fIinputString\fP - The string to be encoded. 
.br
\fItypeOfEncoding\fP - The type of encoding required. 
.RE
.PP
\fBReturns:\fP
.RS 4
encodedString - The encoded string using the ESAPIEncodingType is returned.
.RE
.PP
{ 
.PP
.nf
 char inputString[] = 'sometext';
        ESAPIStringOperation * encodedStringOperation = ESAPIEncode ( inputString, ESAPIEncodingTypePercentEncoding );
        if ( encodedStringOperation->operationSuccessful )
        {
                char * encodedString = encodedStringOperation->returnString;
                //Use the encodedString for operations.
                free ( encodedString );
        }
        else
        {
                char * errorDescription = encodedStringOperation->errorDescription;
                //The encoding has failed. Manage accordingly.
                free ( errorDescription );
        }
        free ( encodedStringOperation );

.fi
.PP
 } 
.PP
Definition at line 21 of file ESAPICEncoder.c.
.PP
References encodingFunctionsArray, ESAPIStringOperation::errorDescription, numberOfAvailableCodecs, and ESAPIStringOperation::operationSuccessful.
.PP
Referenced by main().
.SH "Variable Documentation"
.PP 
.SS "\fBESAPIStringOperation\fP*(*  \fBdecodingFunctionsArray\fP[2])(char *) = { ESAPICUrlEncoderDecode , ESAPICBase64EncoderDecode }"
.PP
Definition at line 19 of file ESAPICEncoder.c.
.PP
Referenced by ESAPICDecode().
.SS "\fBESAPIStringOperation\fP*(*  \fBencodingFunctionsArray\fP[2])(char *) = { ESAPICUrlEncoderEncode , ESAPICBase64EncoderEncode }"
.PP
Definition at line 18 of file ESAPICEncoder.c.
.PP
Referenced by ESAPICEncode().
.SS "const int \fBnumberOfAvailableCodecs\fP = 2"
.PP
Definition at line 17 of file ESAPICEncoder.c.
.PP
Referenced by ESAPICCanonicalizationAllAvailableEncodings(), ESAPICDecode(), and ESAPICEncode().
.SH "Author"
.PP 
Generated automatically by Doxygen for ESAPI from the source code.
